from pydantic import BaseModel


class MessageBase(BaseModel):
    text: str
    sender: int


class MessageCreate(MessageBase):
    pass


class Message(MessageBase):
    id: int
    owner_id: int

    class Config:
        orm_mode = True


class UserBase(BaseModel):
    email: str
    username: str


class UserCreate(UserBase):
    password: str


class User(UserBase):
    id: int
    messages: list[Message] = []

    class Config:
        orm_mode = True
